#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
CPULIMIT=$(which cpulimit)
echo "CPULIMIT=$CPULIMIT"
echo "$CPULIMIT --exe firefox --limit 70 "
echo "$CPULIMIT --exe chromium --limit 70"

HD=/dev/sda
#/sbin/hdparm -B 254 ${HD}
#hdparm -B 255 -S 0 /dev/sda
hdparm -B 254 -S 0 ${HD}
#sudo sh -c 'echo 50 > /proc/acpi/video/VID1/LCD0/brightness
if [ -e /sys/devices/platform/smapi/BAT0/start_charge_thresh ] ; then
    echo 60 > /proc/acpi/video/VID1/LCD0/brightness
    #echo "enable,0x00ffffff" > /proc/acpi/ibm/hotkey
    #echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
    echo 30 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
    echo 100 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh
    echo 17 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes
    #http://kooyee.javaeye.com/blog/340882 thinkpad power
    echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
    echo 5 > /proc/sys/vm/laptop_mode
    echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
    #####echo 1 >/sys/devices/system/cpu/sched_mc_power_savings
    echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

    echo 50 > /proc/acpi/video/VID1/LCD0/brightness
    #cpufreq-set -c 0 -f 1.2GHz
    #cpufreq-set -c 1 -f 1.2GHz
    cpufreq-set -c 0 -f 0.8GHz
    cpufreq-set -c 1 -f 0.8GHz

fi
